@extends('admin.main')

@section('body')
	<div class="main-title">
		<h2>{{isset($info) ? '编辑':'新增'}}配置</h2>
	</div>
	<form action="" method="post" class="form-horizontal">
		<div class="form-item">
			<label class="item-label">配置标识<span class="check-tips">（用于C函数调用，只能使用英文且不能重复）</span></label>
			<div class="controls">
				<input type="text" class="text input-large" name="name" value="{{isset($info) ? $info['name'] : ''}}">
			</div>
		</div>
		<div class="form-item">
			<label class="item-label">配置标题<span class="check-tips">（用于后台显示的配置标题）</span></label>
			<div class="controls">
				<input type="text" class="text input-large" name="title" value="{{isset($info) ? $info['title'] : ''}}">
			</div>
		</div>
		<div class="form-item">
			<label class="item-label">排序<span class="check-tips">（用于分组显示的顺序）</span></label>
			<div class="controls">
				<input type="text" class="text input-small" name="sort" value="{{isset($info) ? $info['sort'] : 0}}">
			</div>
		</div>
		<div class="form-item">
			<label class="item-label">配置类型<span class="check-tips">（系统会根据不同类型解析配置值）</span></label>
			<div class="controls">
				<select name="type">
					@if(count(C('CONFIG_TYPE_LIST')))
						@foreach(C('CONFIG_TYPE_LIST') as $k => $v)
						<option value="{{$k}}" @if(isset($info) && $info['type'] == $k) selected @endif>{{$v}}</option>
						@endforeach
					@endif
				</select>
			</div>
		</div>
		<div class="form-item">
			<label class="item-label">配置分组<span class="check-tips">（配置分组 用于批量设置 不分组则不会显示在系统设置中）</span></label>
			<div class="controls">
				<select name="group">
					<option value="0">不分组</option>
					@if(count(C('CONFIG_GROUP_LIST')))
						@foreach(C('CONFIG_GROUP_LIST') as $k => $v)
							<option value="{{$k}}" @if(isset($info) && $info['group'] == $k) selected @endif>{{$v}}</option>
						@endforeach
					@endif
				</select>
			</div>
		</div>
		<div class="form-item">
			<label class="item-label">配置值<span class="check-tips">（配置值）</span></label>
			<div class="controls">
				<label class="textarea input-large">
					<textarea name="value">{{isset($info) ? $info['value'] : ''}}</textarea>
				</label>
			</div>
		</div>
		<div class="form-item">
			<label class="item-label">配置项<span class="check-tips">（如果是枚举型 需要配置该项）</span></label>
			<div class="controls">
				<label class="textarea input-large">
					<textarea name="extra">{{isset($info) ? $info['extra'] : ''}}</textarea>
				</label>
			</div>
		</div>
		<div class="form-item">
			<label class="item-label">说明<span class="check-tips">（配置详细说明）</span></label>
			<div class="controls">
				<label class="textarea input-large">
					<textarea name="remark">{{isset($info) ? $info['remark'] : ''}}</textarea>
				</label>
			</div>
		</div>
		<div class="form-item">
			<input type="hidden" name="id" value="{{isset($info) ? $info['id'] : ''}}">
			<button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
			<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
		</div>
	</form>
</block>
@endsection